/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package systole.processor.filters;

import systole.domain.signals.Segment;

/**
 *
 * @author user
 */
public class FilterProcessor {


    /**
     * @param rawSignal
     * @param settings
     * @return pulse wave filtered
     */
    public static Segment filterPulseWave(Segment rawSignal, FilterSettings settings){

        Segment filtered = rawSignal;

        int maxIterations = settings.getDefaultIterations();
        Filter filt = settings.getFilt();
        FilterConfiguration fConfig = settings.getFConfig();
        FilterAlgorithm fAlg = settings.getFAlg();

        //Se filtra la señal el numero de iteraciones que hayan sido seteadas
        for (int iter = 0; iter < maxIterations; iter++){
            filtered = filt.apply(filtered, fConfig, fAlg);
        }

        filt.clearFilterCoeffs();

        return filtered;
    }



}
